<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>处理用于输入</h2>
      <!-- v-on指令用于添加事件 -->
      <!-- 括号是可以加也可以不加的 -->
      <button v-on:click="handleClick(111)">btn</button>
      <button v-on:click="handleClick(222)">btn</button>
      <!-- 如果要传event，是不能加括号的 -->
      <!-- 如果加了括号还想传event，那么需要手动传入$event -->
      <button v-on:click="fn(333, $event)">event</button>
    </div>

    <script src="../Vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {},
        methods: {
          handleClick(num) {
            console.log(num);
          },
          fn(n, e) {
            console.log(n, e);
          },
        },
      });
    </script>
  </body>
</html>
